package no8;

import java.util.*;
import org.junit.Test;

public class ArrayTest {
	@Test
	public void Test(){
		//equals
		int[] arr1 = new int[] {1, 2, 3, 4};
		int[] arr2 = new int[] {1, 3, 2, 4};
		boolean isEquals = Arrays.equals(arr1, arr2);
		System.out.println(isEquals);
		//toString
		System.out.println(Arrays.toString(arr1));
		System.out.println(Arrays.toString(arr2));
		//fill
		Arrays.fill(arr1, 10);
		System.out.println(Arrays.toString(arr1));
		//sort
		Arrays.sort(arr2);
		System.out.println(Arrays.toString(arr2));
		//binarySearch
		int[] arr3 = new int[] {-98, -34, 2, 34, 54, 66, 79, 105, 210, 233};
		int index = Arrays.binarySearch(arr3, 210);
		System.out.println("该值所在的位置" + index);
		//如果返回是负数就是没找到
	}
}

